# SPDX-License-Identifier: Apache-2.0
"""
Add psf_staff boolean flag

Revision ID: 590c513f1c74
Revises: d0c22553b338
Create Date: 2021-06-07 11:49:50.688410
"""

import sqlalchemy as sa

from alembic import op

revision = "590c513f1c74"
down_revision = "d0c22553b338"

# Note: It is VERY important to ensure that a migration does not lock for a
#       long period of time and to ensure that each individual migration does
#       not break compatibility with the *previous* version of the code base.
#       This is because the migrations will be ran automatically as part of the
#       deployment process, but while the previous version of the code is still
#       up and running. Thus backwards incompatible changes must be broken up
#       over multiple migrations inside of multiple pull requests in order to
#       phase them in over multiple deploys.


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "users",
        sa.Column(
            "is_psf_staff",
            sa.Boolean(),
            server_default=sa.sql.false(),
            nullable=False,
        ),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("users", "is_psf_staff")
    # ### end Alembic commands ###
